package org.museum.collection.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.museum.collection.domain.entity.Collection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.museum.collection.domain.pojo.CustomCollection;
import org.museum.collection.domain.pojo.ListTableCollectionDetail;

import java.util.List;

/**
 * <p>
 * 藏品主表 Mapper 接口
 * </p>
 *
 * @author zafkiel
 * @since 2025-07-11
 */
@Mapper
public interface CollectionMapper extends BaseMapper<Collection> {


    //查询藏品的详情的所有信息
    @Select("select *from collection_details where name=#{name}")
    ListTableCollectionDetail getCollectionDetail(String name);

    //查询随机的四个藏品信息
    @Select("select *from collection_details where subcategory= #{category} order by rand() limit 4")
    List<CustomCollection> getRandomCollection(String category);
}
